package com.eight.homepage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eight.common.pojo.TbArticle;
import com.eight.homepage.dao.ArticleDao;
import com.eight.homepage.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * @author 向文豪
 * @program: eight-education-parent
 * @description:
 * @date 2023/5/30 18:39
 */
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleDao articleDao;


    @Override
    public TbArticle findAll(String id) {
        QueryWrapper<TbArticle> wrapper = new QueryWrapper<>();
        if(StringUtils.hasText(id)){
            wrapper.eq("nav_id",id);
        }
        TbArticle tbArticle = articleDao.selectOne(wrapper);
        return tbArticle;
    }

    @Override
    public int updateArticle(TbArticle  article) {
        int i = articleDao.updateById(article);
        return i;
    }
}
